package com.kaishengit.service;

import com.kaishengit.dao.GoalDao;
import com.kaishengit.entity.Goal;
import com.kaishengit.util.StringUtil;
import com.kaishengit.util.db.Page;

public class GoalService {
	private GoalDao dao = new GoalDao();
	public void save(String name,String desc,String employeeid,String projectid){
		Goal goal = new Goal();
		
		goal.setId(StringUtil.getId());
		goal.setName(name);
		goal.setDesc(desc);
		goal.setEmployeeid(employeeid);
		goal.setProjectid(projectid);
		
		dao.save(goal);
		
	}
	public Page<Goal> findByPageAndEmployeeIdAndProjectId(int pageNum,String employeeid,String projectid) {
		return dao.findByPageAndEmployeeIdAndProjectId(pageNum,employeeid,projectid);
	}
	public Goal findById(String id) {
		
		return dao.findById(id);
	}
	public void editgoal(String id, String name, String desc) {
		Goal goal = dao.findById(id);
		goal.setName(name);
		goal.setDesc(desc);
		
		dao.update(goal);
		
	}
	public void delGoalById(String id) {
		dao.delGoalById(id);
		
	}
}
